﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Global : MonoBehaviour {
	public GameObject UiPancake;
	public GameObject PhysicPancake;
	public GameObject Arrow;
	public GameObject Hb;
	public static bool gameStart=true;
	public static int PanCakesNumber;
	public List<GameObject> MyPancakes;

	public GameObject Panel;
	public GameObject BestScore;
	public GameObject CurrentScore;

	void Start (){
		gameStart = true;
		PanCakesNumber = 0;
	}

	public void GameOver(){
		gameStart = false;
		Panel.SetActive (true);
		Hb.SetActive (true);
		if (PanCakesNumber > PlayerPrefs.GetInt("Best", 0)) {
			PlayerPrefs.SetInt ("Best",PanCakesNumber);
		}

		BestScore.GetComponent<Text> ().text = PlayerPrefs.GetInt ("Best", 0).ToString ();
		CurrentScore.GetComponent<Text> ().text = PanCakesNumber.ToString ();

		for (int i = 0; i < MyPancakes.Count; i++) {
			MyPancakes [i].GetComponent<Animator> ().SetInteger ("EyesStat", 3);
		}
	}

	public void GrowCamera(){
		Camera.main.orthographicSize += 0.2f;
		Camera.main.transform.position= new Vector3 (Camera.main.transform.position.x,Camera.main.transform.position.y+0.2f,Camera.main.transform.position.z);
	}
	public void mm(){
		SceneManager.LoadScene ("MainMenu");
	}

	public void StartGame(){
		SceneManager.LoadScene ("SampleScene");
	}
}
